package com.qgzj.response;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * 分页返回对象
 * 
 * @author: yangyangbian
 */
@ApiModel(value = "分页返回对象", description = "分页返回对象")
@Data
public class PageQueryRes<T> {

    @ApiModelProperty(value = "总记录数", name = "count")
    private Integer count = 0;

    @ApiModelProperty(value = "页码", name = "page")
    private Integer page = 1;

    @ApiModelProperty(value = "总页数", name = "totalPage")
    private Integer totalPage = 0;

    @ApiModelProperty(value = "每页记录数", name = "pageSize")
    private Integer pageSize = 10;

    @ApiModelProperty(value = "结果集", name = "list")
    private List<T> list;

    public Integer getTotalPage() {
        return count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
    }
}
